﻿using Nop.Core.Domain.Logistics;
using System.Data.Entity.ModelConfiguration;

namespace Nop.Data.Mapping.Logistics
{
    public partial class PackageNoteMap : EntityTypeConfiguration<PackageNote>
    {
        public PackageNoteMap()
        {
            this.ToTable("LogisticsPackageNote");
            this.HasKey(pn => pn.Id);
            this.Property(pn => pn.Note).IsRequired();
            this.Property(pn => pn.Location).IsOptional().HasMaxLength(200);
            this.Property(pn => pn.DisplayToCustomer).IsRequired();
            this.Property(pn => pn.CreatedOnUtc).IsRequired();
            this.Property(pn => pn.TypeId).IsRequired();

            this.Ignore(pn => pn.Type);
            this.Ignore(pn => pn.ShippingStatus);

            this.HasRequired(pn => pn.Package)
                .WithMany()
                .HasForeignKey(pn => pn.PackageId);

            this.HasRequired(pn => pn.Customer)
                .WithMany()
                .HasForeignKey(pn => pn.CustomerId);
        }
    }
}
